package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.DeviceCategory;
import com.dmpp.mes.service.DeviceCategoryService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("DeviceCategory")
public class DeviceCategoryController {
//设备类别
    @Autowired
    private DeviceCategoryService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);
        return service.findAll();
    }

    @RequestMapping(value = "/FindByCategory", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findByCategory(String category) {
        return service.findByCategory(category);
    }

    @RequestMapping(value = "/UpdateById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateById(DeviceCategory deviceCategory) {
        return service.updateById(deviceCategory);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(DeviceCategory deviceCategory) {
        return service.insert(deviceCategory);
    }

    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData delete(String category) {
        return service.delete(category);
    }

}
